Morning Session Exercises

Afternoon Session Exercises

Look through the paper to get an idea of what this network represents. What do the nodes and edges represent?

The nodes represent characters of the GoT saga. The edges maybe represent the number of times the characters have interacted with each other. These edges represent the relationships between characters.

Look at the data in RStudio using the ‘View’ function. This matrix encodes a network. Can you figure out how? What do the rows stand for and what do the columns stand for?

The rows stand for the character pairings relationship strength. The columns stand for character 1, character 2, interaction strength.

When plotting an undirected graph using an adjacency or weights matrix as input I normally do not have to set the directed argument? Now that I use an edgelist, however, I do. Why?

We use the directed = FALSE argument because the adjacency matrix entails information about the direction in the symmetry. Here however we don’t have any symmetry information and therefore we need to be explicit.

Recreate the plot above, changing the layout to a spring layout, the edge color to ‘“darkblue”‘ and the node size to 3. Look at the qgraph help page to figure out the commands needed (?qgraph). Note: your computer might generate a different spring layout (nodes placed on different locations).

What values did qgraph set to cut and maximum? Note: minimum is always set to 0 by default and not shown with details = TRUE unless it differs from 0.

The cut value defaults to 0 for graphs with less then 20 nodes. For larger graphs the cut value is automatically chosen to be equal to the maximum of the 75th quantile of absolute edge strengths or the edge strength corresponding to 2n-th edge strength (n being the number of nodes). In this case it equals 14.

qgraph regards the highest of the maximum or highest absolute edge weight as the highest weight to scale the edge widths too. To compare several graphs, set this argument to a higher value than any edge weight in the graphs (typically 1 for correlations). In this case it equals 96.

Set the minimum argument to 1, 5 and 10 while using a spring layout. How does the network change? Do the same using the threshold argument. Can you explain why the layout remains the same using minimum but changes using threshold?

The plots with the different minimum values are shown below:

The plots with the different cutoff values are shown below:

The layout remains the same using minimum because edges with absolute weights under that value are not shown (but not omitted). The layout differ using threshold because edges with absolute weight that are not above this value are removed from the network. This differs from minimum which simply changes the scaling of width and color so that edges with absolute weight under minimum are not plotted. Setting a threshold influences the spring layout and centrality measures obtained with the graph whereass setting a minimum does not.

Only by looking at the above picture, can you derive: (i) The degree-centrality of Paris? (ii) The shortest path length between Milan and New York, and how many paths there are of this length? (iii) Of all shortest paths between all pairs of nodes, how many go through Santiago?

Make a change to the Layout argument to place the node Jakarta a bit lower

Compare the centrality of the cities named “Bangkok” and “Atlanta”

##            City Node.Strength   Closeness Betweenness
## Atlanta Atlanta             3 0.005347594    23.42381
## Bangkok Bangkok             5 0.005076142    41.98203

List the most and least central node according to degree, closeness and betweenness. If multiple nodes are equally central, list them all.

## # A tibble: 5 x 5
##   variable        max   min Cities_max Cities_min    
##   <fct>         <dbl> <dbl> <chr>      <chr>         
## 1 Node Strength    11     1 Istanbul   St. Petersburg
## 2 Node Strength    11     1 Hong Kong  St. Petersburg
## 3 Closeness        38     1 Chicago    Seoul         
## 4 Betweenness      46     1 London     Beijing       
## 5 Betweenness      46     1 London     Buenos Aires

Compute the average degree, closeness and betweenness per virus (color). Which virus do you think is the most dangerous?

##    Color Betweenness   Closeness Node Strength
## 1  black    190.0787 0.005326764      4.333333
## 2   blue    156.0685 0.005395670      3.916667
## 3    red    102.9432 0.004929818      3.916667
## 4 yellow    141.2428 0.005086484      3.333333

I think that the most dangerous is the black virus.